# include <stdio.h>
# include "chainingHashMap.h"

typedef struct {
	int a;
	int b;
} Info;

Info * nova (int a, int b) {
	Info *new = (Info *)malloc(sizeof(Info));
	new->a= a;
	new->b= b;
	return new;
}

void mostra (Info *i) {
	fprintf(stdout,"A: %d\tB: %d\n",i->a,i->b);
}

int myEq (void *a, void *b) {
	return ((*(int *)a) == (*(int *)b));
}
int myHash(void *a, int size) {
	return (*(int *)a)%size;
}
# define SIZE 10
int main () {
	ChainingHashMap *map = newChainingHashMap(23);
	Info *tmp;
	map->eq = myEq;
	map->hash = myHash;
	int chaves[SIZE];
	Info *infos[SIZE];
	int i;
	for (i=0;i<SIZE;i++) {
		infos[i] = nova(i*2,i*3);
		chaves[i] = i;
		putChaining(map,&chaves[i],infos[i]);
	}
	LinkedList *lst = keySetChaining(map);
	while (lst) {
		tmp = getData(lst);
		printf("%d\n",tmp->a);
		lst = lst->next;
	}
	return 0;
}
